#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <mysql.h>

int main(void)
{
  MYSQL *mysql;
  MYSQL_RES *res;
  MYSQL_ROW row;

  mysql = mysql_init(NULL);
  //  (mysql,DB_HOST,DB_USER,DB_PASSWD,DB_NAME,DB_PORT,NULL,0))
  if(!mysql_real_connect(mysql,"192.168.65.224","shopex","shopex","test",3307,NULL,0))
  {
    fprintf(stderr,"Can't connect Mysql %s\n",mysql_error(mysql));
    exit(-1);
  }

  char sql[128] = "show slave status";
  
  if(!mysql_query(mysql,sql))
  {
    res = mysql_store_result(mysql);
  }else
  {
    fprintf(stderr,"Can't Query %s!\n",mysql_error(mysql));
    exit(-1);
  }
  
  while((row = mysql_fetch_row(res)))
  {
    if(row[32] == NULL)
      printf("row[32] is NULL!\n");
  }
  
  return 0;
}
